<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class ProjectTeam extends Model
{
    use HasFactory;

    protected $fillable = [
        'company_id',
        'admin_id',
        'project_id',
        'team_id',
        'scene',
        'scene_mobile',
        'scene_id_card',
        'daily_wage',
        'in_time',
        'out_time',
        'in_flexible_minutes',
        'out_flexible_minutes',
        'late_threshold',
        'early_leave_threshold',
        'remarks',
    ];
    const POSTONLY = [
        'company_id',
        'admin_id',
        'project_id',
        'team_id',
        'scene',
        'scene_mobile',
        'scene_id_card',
        'daily_wage',
        'in_time',
        'out_time',
        'in_flexible_minutes',
        'out_flexible_minutes',
        'late_threshold',
        'early_leave_threshold',
        'remarks',
    ];

    protected function serializeDate(\DateTimeInterface $date)
    {
        return $date->format($this->dateFormat ?: 'Y-m-d H:i:s');
    }

    public function team()
    {
        return $this->hasOne(LaborTeam::class,'id','team_id');
    }

}
